<template>
<div class="table">
        <div class="divSearch">
            <!--搜索框-->
            <Row>
                <!--根据需求删除不不要查询条件-->
                <Col :lg="{span:5}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                <label class="searchLabel">地区:</label>
                    <Select v-model="searchModel.AreaCode"  placeholder="请选择..." class="searchInput" @on-change="getStatsList()">
                        <Option :value="userinfo.AreaCode" >全部</Option>
                        <Option :value="item.value" v-for="item in AreaList" :key="item.value">{{item.label}}</Option>
                    </Select>
                </Col>
                <Col :lg="{span:5}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                    <label class="searchLabel">年份:</label>
                    <Select v-model="searchModel.FillInYear"  placeholder="请选择..." class="searchInput" @on-change="getStatsList()">
                        <Option value="">全部</Option>
                        <Option :value="item.DictText" v-for="item in CreateYearList" :key="item.DictText">{{item.DictText}}</Option>
                    </Select>
                </Col>
                <!-- <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}">
                    <Button icon="ios-search" type="primary" @click="getStatsList()" class="searchButton">查询</Button>
                </Col> -->
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}">
                    <Button icon="ios-export" type="primary" @click="getExcelData()" class="searchButton">数据导出</Button>
                </Col>
                <Col >
                    <RadioGroup v-model="CheckButton" @on-change="changeButton" type="button" class="searchRight" >
                        <Radio label="listShow" title="列表"><span class="iconTitle">列表</span><Icon type="ios-paper" size="16"></Icon></Radio>
                        <Radio label="pieShow" title="饼图"><span class="iconTitle">柱状图</span><Icon type="ios-pie" size="16"></Icon></Radio>   
                        <Radio label="mapShow" title="地图"><span class="iconTitle">地图</span><Icon type="android-map" size="16"></Icon></Radio>                                                                               
                    </RadioGroup>    
                </Col>
            </Row>
        </div>
        <Row  v-show="listShow">
            <!-- 列表-->
            <Col>
                <table  class="ContentTable">
                    <caption>
                        <div>
                            <span class="tableNum">{{CurrentYear}}年(八){{CurrentAreaName}}蔬菜生产经营实体及相关情况(全面统计)</span>
                            <span class="tip">单位：个、亩、元</span>
                        </div>
                    </caption>
                    <thead>
                        <tr>
                            <th rowspan="3" width="72">地区</th>
                            <th colspan="4">蔬菜市场</th>
                            <th colspan="6">蔬菜企业</th>
                            <th colspan="4">蔬菜农民合作社</th>
                            <th colspan="4">蔬菜家庭农场</th>
                            <th colspan="11">相关质量标准认证情况</th>
                            <!-- <th rowspan="3" v-show="isProvince" width="100px">操作</th> -->
                        </tr>
                        <tr>
                            <th rowspan="2">总数</th>
                            <th colspan="3">其中</th>
                            <th rowspan="2">总数</th>
                            <th colspan="5">其中</th>
                            <th rowspan="2">蔬菜农民合作社数量</th>
                            <th rowspan="2">参加蔬菜农民合作社农户数</th>
                            <th rowspan="2">蔬菜农民合作社经营面积(其中:流转土地面积)</th>
                            <th rowspan="2">蔬菜农民合作社年销售收入</th>
                            <th rowspan="2">蔬菜家庭农场数量</th>
                            <th rowspan="2">参加蔬菜家庭农场农户数</th>
                            <th rowspan="2">蔬菜家庭农场经营面积(其中:流转土地面积)</th>
                            <th rowspan="2">蔬菜家庭农场年销售收入</th>
                            <th rowspan="2">国家级农业标准化示范县数量</th>
                            <th rowspan="2">出口食品农产品质量安全示范区数量</th>
                            <th rowspan="2">中国驰名商标数</th>
                            <th rowspan="2">中国名牌产品数</th>
                            <th rowspan="2">云南省著名商标数</th>
                            <th rowspan="2">无公害农产品数</th>
                            <th rowspan="2">无公害农产品认证面积</th>
                            <th rowspan="2">绿色产品数</th>
                            <th rowspan="2">绿色产品认证面积</th>
                            <th rowspan="2">地理标志证明商标数</th>
                            <th rowspan="2">地理标志产品保护认证数</th>
                        </tr>
                        <tr>
                            <th>产地批发市场</th>
                            <th>专业批发市场</th>
                            <th>区域性综合批发市场</th>
                            <th>国家级龙头企业</th>
                            <th>省级龙头企业</th>
                            <th>州(市)级龙头企业</th>
                            <th>县(市、区)级龙头企业</th>
                            <th>其他</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,index)  in datas" :key="item.AreaCode" :class="{'tdColor':index%2!=0}">
                            <td width="72">{{item.AreaName}}</td>
                            <td>{{item.PFSC_Num|formatCurrency}}</td>
                            <td>{{item.PFSC_Cd|formatCurrency}}</td>
                            <td>{{item.PFSC_Zy|formatCurrency}}</td>
                            <td>{{item.PFSC_Qy|formatCurrency}}</td>
                            <td>{{item.VegCompanyNum|formatCurrency}}</td>
                            <td>{{item.ZzNum_Country|formatCurrency}}</td>
                            <td>{{item.ZzNum_Pro|formatCurrency}}</td>
                            <td>{{item.ZzNum_City|formatCurrency}}</td>
                            <td>{{item.ZzNum_Area|formatCurrency}}</td>
                            <td>{{item.ZzNum_Other|formatCurrency}}</td>
                            <td>{{item.VegHzNum|formatCurrency}}</td>
                            <td>{{item.VegNhNum|formatCurrency}}</td>
                            <td>{{item.VegMjNum|formatCurrency}}</td>
                            <td>{{item.VegHzSale|formatCurrency}}</td>
                            <td>{{item.JTNC_Num|formatCurrency}}</td>
                            <td>{{item.JTNC_NMNum|formatCurrency}}</td>
                            <td>{{item.JTNC_Area|formatCurrency}}</td>
                            <td>{{item.JTNC_Sales|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Sfx|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Sfq|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Cmsbs|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Mpcp|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_YnsZmsb|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_WghNum|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Wghmj|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Greencp|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Greencpmj|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Dlsb|formatCurrency}}</td>
                            <td>{{item.ZlrzNum_Dlbh|formatCurrency}}</td>  
                            <!-- <td v-show="isProvince" width="100px">
                                <Button  size="small" type="primary"  @click="getDetail(item.AreaCode)">详情</Button>
                                <Button  size="small" type="primary" @click="getExcelData(item.AreaCode)">导出</Button>
                            </td> -->
                        </tr>
                    </tbody>
                </table>
            </Col>
        </Row>
        <Row v-show="pieShow">
            <!--饼图-->
            <Tabs type="card">
                <TabPane label="蔬菜市场">
                    <div id="divBarOne" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
                <TabPane label="蔬菜企业">
                    <div id="divBarTwo" style="border:1px solid #D7DDE4;"></div>
                </TabPane>
                <TabPane label="蔬菜农民合作社">
                    <div id="divBarThree" style="border:1px solid #D7DDE4; ">2</div>
                </TabPane>
                <TabPane  label="蔬菜家庭农场">
                    <div id="divBarFour" style="border:1px solid #D7DDE4; ">3</div>
                </TabPane>
                <TabPane label="相关质量标准认证情况">
                    <div id="divBarFive" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
            </Tabs>
        </Row>
        <Row  v-show="mapShow">
            <!--地图展示-->
            <Tabs type="card">
                <TabPane label="蔬菜市场">
                    <div id="divMapOne" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
                <TabPane label="蔬菜企业">
                    <div id="divMapTwo" style="border:1px solid #D7DDE4;"></div>
                </TabPane>
                <TabPane label="蔬菜农民合作社">
                    <div id="divMapThree" style="border:1px solid #D7DDE4; ">2</div>
                </TabPane>
                <TabPane  label="蔬菜家庭农场">
                    <div id="divMapFour" style="border:1px solid #D7DDE4; ">3</div>
                </TabPane>
                <TabPane label="相关质量标准认证情况">
                    <div id="divMapFive" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
            </Tabs>
        </Row>
        <Modal v-model="detailView" :mask-closable="false" width="1200" :styles="{top: '10px'}">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">(一){{searchModel.FillInYear}}-{{CurrentAreaName}}-(一)蔬菜用地情况调查表(全面统计)</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
                <table  class="DetailTable">
                    <thead>
                        <tr>
                            <th rowspan="3" width="72">地区</th>
                            <th colspan="4">蔬菜市场</th>
                            <th colspan="6">蔬菜企业</th>
                            <th colspan="4">蔬菜农民合作社</th>
                            <th colspan="4">蔬菜家庭农场</th>
                            <th colspan="11">相关质量标准认证情况</th>
                        </tr>
                        <tr>
                            <th rowspan="2">总数</th>
                            <th colspan="3">其中</th>
                            <th rowspan="2">总数</th>
                            <th colspan="5">其中</th>
                            <th rowspan="2">蔬菜农民合作社数量</th>
                            <th rowspan="2">参加蔬菜农民合作社农户数</th>
                            <th rowspan="2">蔬菜农民合作社经营面积(其中:流转土地面积)</th>
                            <th rowspan="2">蔬菜农民合作社年销售收入</th>
                            <th rowspan="2">蔬菜家庭农场数量</th>
                            <th rowspan="2">参加蔬菜家庭农场农户数</th>
                            <th rowspan="2">蔬菜家庭农场经营面积(其中:流转土地面积)</th>
                            <th rowspan="2">蔬菜家庭农场年销售收入</th>
                            <th rowspan="2">国家级农业标准化示范县数量</th>
                            <th rowspan="2">出口食品农产品质量安全示范区数量</th>
                            <th rowspan="2">中国驰名商标数</th>
                            <th rowspan="2">中国名牌产品数</th>
                            <th rowspan="2">云南省著名商标数</th>
                            <th rowspan="2">无公害农产品数</th>
                            <th rowspan="2">无公害农产品认证面积</th>
                            <th rowspan="2">绿色产品数</th>
                            <th rowspan="2">绿色产品认证面积</th>
                            <th rowspan="2">地理标志证明商标数</th>
                            <th rowspan="2">地理标志产品保护认证数</th>
                        </tr>
                        <tr>
                            <th>产地批发市场</th>
                            <th>专业批发市场</th>
                            <th>区域性综合批发市场</th>
                            <th>国家级龙头企业</th>
                            <th>省级龙头企业</th>
                            <th>州(市)级龙头企业</th>
                            <th>县(市、区)级龙头企业</th>
                            <th>其他</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,index)  in detailDatas" :key="item.AreaCode" :class="{'tdColor':index%2!=0}">
                            <td width="72">{{item.AreaName}}</td>
                            <td>{{item.PFSC_Num}}</td>
                            <td>{{item.PFSC_Cd}}</td>
                            <td>{{item.PFSC_Zy}}</td>
                            <td>{{item.PFSC_Qy}}</td>
                            <td>{{item.VegCompanyNum}}</td>
                            <td>{{item.ZzNum_Country}}</td>
                            <td>{{item.ZzNum_Pro}}</td>
                            <td>{{item.ZzNum_City}}</td>
                            <td>{{item.ZzNum_Area}}</td>
                            <td>{{item.ZzNum_Other}}</td>
                            <td>{{item.VegHzNum}}</td>
                            <td>{{item.VegNhNum}}</td>
                            <td>{{item.VegMjNum}}</td>
                            <td>{{item.VegHzSale}}</td>
                            <td>{{item.JTNC_Num}}</td>
                            <td>{{item.JTNC_NMNum}}</td>
                            <td>{{item.JTNC_Area}}</td>
                            <td>{{item.JTNC_Sales}}</td>
                            <td>{{item.ZlrzNum_Sfx}}</td>
                            <td>{{item.ZlrzNum_Sfq}}</td>
                            <td>{{item.ZlrzNum_Cmsbs}}</td>
                            <td>{{item.ZlrzNum_Mpcp}}</td>
                            <td>{{item.ZlrzNum_YnsZmsb}}</td>
                            <td>{{item.ZlrzNum_WghNum}}</td>
                            <td>{{item.ZlrzNum_Wghmj}}</td>
                            <td>{{item.ZlrzNum_Greencp}}</td>
                            <td>{{item.ZlrzNum_Greencpmj}}</td>
                            <td>{{item.ZlrzNum_Dlsb}}</td>
                            <td>{{item.ZlrzNum_Dlbh}}</td>                          
                        </tr>
                    </tbody>
                </table>
                <div slot="footer"></div>
        </Modal>
    </div>
</template>
<script>
export default {
    data() {
        return {
            self: this,
            CreateYearList: this.GetGroupDict("ReportYear"), //年度
            CurrentYear: this.GetCurrentYear(),//当前年度
            AreaList: this.SearchAreaList(this.GetlocaStorage("VegUserInfo").AreaCode),
            TotalData:[],
            Option:'1',
            CurrentAreaName:'',
            userinfo: this.GetlocaStorage("VegUserInfo"),//获取当前用户信息
            CheckButton:'listShow',
            datas:[],//列表数据
            detailDatas:[],//详情
            isProvince:false,//是否为省级账号(操作栏目显示)
            detailView:false,//modal显示开关
            mapType:'',
            echartsItem0:['蔬菜市场总数','产地批发市场','专业批发市场','区域性综合批发市场'],
            echartsItem1:['蔬菜企业总数','国家级龙头企业','省级龙头企业','州(市)级龙头企业','县(市、区)级龙头企业'],
            echartsItem2:['蔬菜农民合作社数量','参加蔬菜农民合作社农户数','蔬菜农民合作社经营面积','蔬菜农民合作社年销售收入'],
            echartsItem3:['蔬菜家庭农场数量','参加蔬菜家庭农场农户数','蔬菜家庭农场经营面积','蔬菜家庭农场年销售收入'],
            echartsItem4:['国家级农业标准化示范县数量','出口食品农产品质量安全示范区数量','中国驰名商标数','中国名牌产品数','云南省著名商标数','无公害农产品数','无公害农产品认证面积','绿色产品数','绿色产品认证面积','地理标志证明商标数','地理标志产品保护认证数'],
            GeoData:'',
            //柱状图数据
            AreaData:[],
            //蔬菜市场
            PFSC_NumData:[],
            PFSC_CdData:[],
            PFSC_ZyData:[],
            PFSC_QyData:[],
            //蔬菜企业
            VegCompanyNumData:[],
            ZzNum_CountryData:[],
            ZzNum_ProData:[],
            ZzNum_CityData:[],
            ZzNum_AreaData:[],
            ZzNum_OtherData:[],
            //蔬菜农民合作社
            VegHzNumData:[],
            VegNhNumData:[],
            VegMjNumData:[],
            VegHzSaleData:[],
            //蔬菜家庭农场
            JTNC_NumData:[],
            JTNC_NMNumData:[],
            JTNC_AreaData:[],
            JTNC_SalesData:[],
            //相关质量标准认证情况
            ZlrzNum_SfxData:[],
            ZlrzNum_SfqData:[],
            ZlrzNum_CmsbsData:[],
            ZlrzNum_MpcpData:[],
            ZlrzNum_YnsZmsbData:[],
            ZlrzNum_WghNumData:[],
            ZlrzNum_WghmjData:[],
            ZlrzNum_GreencpData:[],
            ZlrzNum_GreencpmjData:[],
            ZlrzNum_DlsbData:[],
            ZlrzNum_DlbhData:[], 
            barList0:[],
            barList1:[],
            barList2:[],
            barList3:[],
            barList4:[],
            //地图数据
            //蔬菜市场
            MapPFSC_NumData:[],
            MapPFSC_CdData:[],
            MapPFSC_ZyData:[],
            MapPFSC_QyData:[],
            //蔬菜企业
            MapVegCompanyNumData:[],
            MapZzNum_CountryData:[],
            MapZzNum_ProData:[],
            MapZzNum_CityData:[],
            MapZzNum_AreaData:[],
            MapZzNum_OtherData:[],
            //蔬菜农民合作社
            MapVegHzNumData:[],
            MapVegNhNumData:[],
            MapVegMjNumData:[],
            MapVegHzSaleData:[],
            //蔬菜家庭农场
            MapJTNC_NumData:[],
            MapJTNC_NMNumData:[],
            MapJTNC_AreaData:[],
            MapJTNC_SalesData:[],
            //相关质量标准认证情况
            MapZlrzNum_SfxData:[],
            MapZlrzNum_SfqData:[],
            MapZlrzNum_CmsbsData:[],
            MapZlrzNum_MpcpData:[],
            MapZlrzNum_YnsZmsbData:[],
            MapZlrzNum_WghNumData:[],
            MapZlrzNum_WghmjData:[],
            MapZlrzNum_GreencpData:[],
            MapZlrzNum_GreencpmjData:[],
            MapZlrzNum_DlsbData:[],
            MapZlrzNum_DlbhData:[], 
            mapList0:[],
            mapList1:[],
            mapList2:[],
            mapList3:[],
            mapList4:[],
            //查询模型：根据需求删除不不要查询条件
            //蔬菜生产情况表代码
            searchModel: {
                Id: '',
                ReportCode: 'VegBasicInfo',
                FillInYear: '',
                TimesType: '',
                AreaCode: this.GetlocaStorage("VegUserInfo").AreaCode,
                PageNumber: 1,
                PageSize: 20,
                Status: '4',
                Opinion: ''
            },
            listShow:false,//列表显示控制器
            pieShow:false,//饼图显示控制器
            mapShow:false,//地图显示控制器
        }  
    },
    //方法
    methods: {
         //展示切换
        changeButton:function(n){
            if(n=="listShow")
            {
                this.listShow=true;//显示列表
                this.pieShow=false;
                this.mapShow=false;
            }
            else if(n=="pieShow")
            {
                this.listShow=false;
                this.pieShow=true;//显示饼图
                this.mapShow=false;
            }
             else if(n=="mapShow")
            {
                this.listShow=false;
                this.pieShow=false;//显示地图
                this.mapShow=true;
            }
            else{
                 this.listShow=true;//默认显示列表
                 this.pieShow=false;
                 this.mapShow=false;
            }
        },
        getStatsList(){
            var self=this;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                self.searchModel.FillInYear = self.searchModel.FillInYear;
            } else {
                self.searchModel.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
            }
            //判断当前用户是否为省级账号
            if(self.userinfo.AreaCode=="530000000000")
            {
                self.isProvince=true;
                self.mapType=self.searchModel.AreaCode;
            }
            else{
                self.mapType=self.userinfo.AreaCode;
            }
            //柱状图数据
            self.AreaData=[];
            //蔬菜市场
            self.PFSC_NumData=[];
            self.PFSC_CdData=[];
            self.PFSC_ZyData=[];
            self.PFSC_QyData=[];
            //蔬菜企业
            self.VegCompanyNumData=[];
            self.ZzNum_CountryData=[];
            self.ZzNum_ProData=[];
            self.ZzNum_CityData=[];
            self.ZzNum_AreaData=[];
            self.ZzNum_OtherData=[];
            //蔬菜农民合作社
            self.VegHzNumData=[];
            self.VegNhNumData=[];
            self.VegMjNumData=[];
            self.VegHzSaleData=[];
            //蔬菜家庭农场
            self.JTNC_NumData=[];
            self.JTNC_NMNumData=[];
            self.JTNC_AreaData=[];
            self.JTNC_SalesData=[];
            //相关质量标准认证情况
            self.ZlrzNum_SfxData=[];
            self.ZlrzNum_SfqData=[];
            self.ZlrzNum_CmsbsData=[];
            self.ZlrzNum_MpcpData=[];
            self.ZlrzNum_YnsZmsbData=[];
            self.ZlrzNum_WghNumData=[];
            self.ZlrzNum_WghmjData=[];
            self.ZlrzNum_GreencpData=[];
            self.ZlrzNum_GreencpmjData=[];
            self.ZlrzNum_DlsbData=[];
            self.ZlrzNum_DlbhData=[]; 
            self.barList0=[];
            self.barList1=[];
            self.barList2=[];
            self.barList3=[];
            self.barList4=[];
            //地图数据
            //蔬菜市场
            self.MapPFSC_NumData=[];
            self.MapPFSC_CdData=[];
            self.MapPFSC_ZyData=[];
            self.MapPFSC_QyData=[];
            //蔬菜企业
            self.MapVegCompanyNumData=[];
            self.MapZzNum_CountryData=[];
            self.MapZzNum_ProData=[];
            self.MapZzNum_CityData=[];
            self.MapZzNum_AreaData=[];
            self.MapZzNum_OtherData=[];
            //蔬菜农民合作社
            self.MapVegHzNumData=[];
            self.MapVegNhNumData=[];
            self.MapVegMjNumData=[];
            self.MapVegHzSaleData=[];
            //蔬菜家庭农场
            self.MapJTNC_NumData=[];
            self.MapJTNC_NMNumData=[];
            self.MapJTNC_AreaData=[];
            self.MapJTNC_SalesData=[];
            //相关质量标准认证情况
            self.MapZlrzNum_SfxData=[];
            self.MapZlrzNum_SfqData=[];
            self.MapZlrzNum_CmsbsData=[];
            self.MapZlrzNum_MpcpData=[];
            self.MapZlrzNum_YnsZmsbData=[];
            self.MapZlrzNum_WghNumData=[];
            self.MapZlrzNum_WghmjData=[];
            self.MapZlrzNum_GreencpData=[];
            self.MapZlrzNum_GreencpmjData=[];
            self.MapZlrzNum_DlsbData=[];
            self.MapZlrzNum_DlbhData=[]; 
            self.mapList0=[];
            self.mapList1=[];
            self.mapList2=[];
            self.mapList3=[];
            self.mapList4=[];
            self.GeoData=self.GetGeoData(self.mapType); 
            self.$http.post('VegProsecution/PostStats', self.searchModel).then(function (res) {
                if(res.data.status===1)
                {
                    self.datas= res.data.model;
                    self.CurrentAreaName=res.data.model[0].AreaName;
                    for(var i=1;i<res.data.model.length;i++)
                    {
                        //柱状图数据
                        self.AreaData.push(res.data.model[i].AreaName);
                        //蔬菜市场
                        self.PFSC_NumData.push(res.data.model[i].PFSC_Num);
                        self.PFSC_CdData.push(res.data.model[i].PFSC_Cd);
                        self.PFSC_ZyData.push(res.data.model[i].PFSC_Zy);
                        self.PFSC_QyData.push(res.data.model[i].PFSC_Qy);
                        //蔬菜企业
                        self.VegCompanyNumData.push(res.data.model[i].VegCompanyNum);
                        self.ZzNum_CountryData.push(res.data.model[i].ZzNum_Country);
                        self.ZzNum_ProData.push(res.data.model[i].ZzNum_Pro);
                        self.ZzNum_CityData.push(res.data.model[i].ZzNum_City);
                        self.ZzNum_AreaData.push(res.data.model[i].ZzNum_Area);
                        self.ZzNum_OtherData.push(res.data.model[i].ZzNum_Other);
                        
                        //蔬菜农民合作社
                        
                        self.VegHzNumData.push(res.data.model[i].VegHzNum);
                        self.VegNhNumData.push(res.data.model[i].VegNhNum);
                        self.VegMjNumData.push(res.data.model[i].VegMjNum);
                        self.VegHzSaleData.push(res.data.model[i].VegHzSale);
                        //蔬菜家庭农场
                        self.JTNC_NumData.push(res.data.model[i].JTNC_Num);
                        self.JTNC_NMNumData.push(res.data.model[i].JTNC_NMNum);
                        self.JTNC_AreaData.push(res.data.model[i].JTNC_Area);
                        self.JTNC_SalesData.push(res.data.model[i].JTNC_Sales);
                        //相关质量标准认证情况
                        self.ZlrzNum_SfxData.push(res.data.model[i].ZlrzNum_Sfx);
                        self.ZlrzNum_SfqData.push(res.data.model[i].ZlrzNum_Sfq);
                        self.ZlrzNum_CmsbsData.push(res.data.model[i].ZlrzNum_Cmsbs);
                        self.ZlrzNum_MpcpData.push(res.data.model[i].ZlrzNum_Mpcp);
                        self.ZlrzNum_YnsZmsbData.push(res.data.model[i].ZlrzNum_YnsZmsb);
                        self.ZlrzNum_WghNumData.push(res.data.model[i].ZlrzNum_WghNum);
                        self.ZlrzNum_WghmjData.push(res.data.model[i].ZlrzNum_Wghmj);
                        self.ZlrzNum_GreencpData.push(res.data.model[i].ZlrzNum_Greencp);
                        self.ZlrzNum_GreencpmjData.push(res.data.model[i].ZlrzNum_Greencpmj);
                        self.ZlrzNum_DlsbData.push(res.data.model[i].ZlrzNum_Dlsb);
                        self.ZlrzNum_DlbhData.push(res.data.model[i].ZlrzNum_Dlbh); 
                        //地图数据
                        //蔬菜市场
                        self.MapPFSC_NumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PFSC_Num});
                        self.MapPFSC_CdData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PFSC_Cd});
                        self.MapPFSC_ZyData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PFSC_Zy});
                        self.MapPFSC_QyData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PFSC_Qy});
                        //蔬菜企业
                        self.MapVegCompanyNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].VegCompanyNum});
                        self.MapZzNum_CountryData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_Country});
                        self.MapZzNum_ProData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_Pro});
                        self.MapZzNum_CityData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_City});
                        self.MapZzNum_AreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_Area});
                        self.MapZzNum_OtherData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_Other});
                        //蔬菜农民合作社
                        self.MapVegHzNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].VegHzNum});
                        self.MapVegNhNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].VegNhNum});
                        self.MapVegMjNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].VegMjNum});
                        self.MapVegHzSaleData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].VegHzSale});
                        //蔬菜家庭农场
                        self.MapJTNC_NumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTNC_Num});
                        self.MapJTNC_NMNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTNC_NMNum});
                        self.MapJTNC_AreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTNC_Area});
                        self.MapJTNC_SalesData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTNC_Sales});
                        //相关质量标准认证情况
                        self.MapZlrzNum_SfxData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Sfx});
                        self.MapZlrzNum_SfqData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Sfq});
                        self.MapZlrzNum_CmsbsData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Cmsbs});
                        self.MapZlrzNum_MpcpData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Mpcp});
                        self.MapZlrzNum_YnsZmsbData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_YnsZmsb});
                        self.MapZlrzNum_WghNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_WghNum});
                        self.MapZlrzNum_WghmjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Wghmj});
                        self.MapZlrzNum_GreencpData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Greencp});
                        self.MapZlrzNum_GreencpmjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Greencpmj});
                        self.MapZlrzNum_DlsbData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Dlsb});
                        self.MapZlrzNum_DlbhData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_Dlbh}); 
                    }
                    self.barList0.push(self.PFSC_NumData,self.PFSC_CdData,self.PFSC_ZyData,self.self.PFSC_QyData);
                    self.barList1.push(self.VegCompanyNumData,self.ZzNum_CountryData,self.ZzNum_ProData,self.ZzNum_CityData,self.ZzNum_AreaData,self.ZzNum_OtherData);
                    self.barList2.push(self.VegHzNumData,self.VegNhNumData,self.VegMjNumData,self.VegHzSaleData);
                    self.barList3.push(self.JTNC_NumData,self.JTNC_NMNumData,self.JTNC_AreaData,self.JTNC_SalesData);
                    self.barList4.push(self.ZlrzNum_SfxData,self.ZlrzNum_SfqData,self.ZlrzNum_CmsbsData,self.ZlrzNum_MpcpData,self.ZlrzNum_YnsZmsbData,self.ZlrzNum_WghNumData,self.ZlrzNum_WghmjData,self.ZlrzNum_GreencpData,self.ZlrzNum_GreencpmjData,self.ZlrzNum_DlsbData,self.ZlrzNum_DlbhData);
                    self.mapList0.push(self.MapPFSC_NumData,self.MapPFSC_CdData,self.MapPFSC_ZyData,self.MapPFSC_QyData);
                    self.mapList1.push(self.MapVegCompanyNumData,self.MapZzNum_CountryData,self.MapZzNum_ProData,self.MapZzNum_CityData,self.MapZzNum_AreaData,self.MapZzNum_OtherData);
                    self.mapList2.push(self.MapVegHzNumData,self.MapVegNhNumData,self.MapVegMjNumData,self.MapVegHzSaleData);
                    self.mapList3.push(self.MapJTNC_NumData,self.MapJTNC_NMNumData,self.MapJTNC_AreaData,self.MapJTNC_SalesData);
                    self.mapList4.push(self.MapZlrzNum_SfxData,self.MapZlrzNum_SfqData,self.MapZlrzNum_CmsbsData,self.MapZlrzNum_MpcpData,self.MapZlrzNum_YnsZmsbData,self.MapZlrzNum_WghNumData,self.MapZlrzNum_WghmjData,self.MapZlrzNum_GreencpData,self.MapZlrzNum_GreencpmjData,self.MapZlrzNum_DlsbData,self.MapZlrzNum_DlbhData);
                    self.showEcharts();
                }
            });
        },
        showEcharts(){//显示柱状图
            //显示柱状图
            var self=this;
            var containerBarOne=document.getElementById('divBarOne');
            var containerBarTwo=document.getElementById('divBarTwo');
            var containerBarThree=document.getElementById('divBarThree');
            var containerBarFour=document.getElementById('divBarFour');
            var containerBarFive=document.getElementById('divBarFive');
            var containerTable=document.getElementsByClassName('ivu-col ivu-col-span-4');
            // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
            var resizeContainerBar = function () {
                //containerTable[0].clientWidth 左侧菜单栏的宽度
                containerBarOne.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerBarOne.style.height = (window.innerHeight-315)+'px';
                containerBarTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerBarTwo.style.height = (window.innerHeight-360)+'px';
                containerBarThree.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerBarThree.style.height = (window.innerHeight-360)+'px';
                containerBarFour.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerBarFour.style.height = (window.innerHeight-360)+'px';
                containerBarFive.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerBarFive.style.height = (window.innerHeight-360)+'px';
            };
            //设置容器高宽
            resizeContainerBar();
            var myBarOne = myEcharts.init(containerBarOne, 'shine');
            var myBarTwo = myEcharts.init(containerBarTwo, 'shine');
            var myBarThree = myEcharts.init(containerBarThree, 'shine');
            var myBarFour = myEcharts.init(containerBarFour, 'shine');
            var myBarFive = myEcharts.init(containerBarFive, 'shine');
            var BarNameOne=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜市场柱状统计图(全面统计)';
            var BarNameTwo=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜企业柱状统计图(全面统计)';
            var BarNameThree=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜农民合作社柱状统计图(全面统计)';
            var BarNameFour=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜家庭农场柱状统计图(全面统计)';
            var BarNameFive=self.CurrentYear+'年(八)'+self.CurrentAreaName+'相关质量标准认证情况柱状统计图(全面统计)';
            var optionBarOne = self.GetBarOption(BarNameOne,self.AreaData,self.echartsItem0,self.barList0);
            var optionBarTwo = self.GetBarOption(BarNameTwo,self.AreaData,self.echartsItem1,self.barList1);
            var optionBarThree = self.GetBarOption(BarNameThree,self.AreaData,self.echartsItem2,self.barList2);
            var optionBarFour = self.GetBarOption(BarNameFour,self.AreaData,self.echartsItem3,self.barList3);
            var optionBarFive = self.GetBarOption(BarNameFive,self.AreaData,self.echartsItem4,self.barList4);
            myBarOne.setOption(optionBarOne);
            myBarTwo.setOption(optionBarTwo);
            myBarThree.setOption(optionBarThree);
            myBarFour.setOption(optionBarFour);
            myBarFive.setOption(optionBarFive);
            //******************显示地图
            var self=this;
            var containerMapOne=document.getElementById('divMapOne');
            var containerMapTwo=document.getElementById('divMapTwo');
            var containerMapThree=document.getElementById('divMapThree');
            var containerMapFour=document.getElementById('divMapFour');
            var containerMapFive=document.getElementById('divMapFive');
            // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
            var resizeContainerMap = function () {
                //containerTable[0].clientWidth 左侧菜单栏的宽度
                containerMapOne.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapOne.style.height = (window.innerHeight-312)+'px';
                containerMapTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapTwo.style.height = (window.innerHeight-312)+'px';
                containerMapThree.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapThree.style.height = (window.innerHeight-312)+'px';
                containerMapFour.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapFour.style.height = (window.innerHeight-312)+'px';
                containerMapFive.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapFive.style.height = (window.innerHeight-312)+'px';
            };
            //设置容器高宽
            resizeContainerMap();

            var myMapOne = myEcharts.init(containerMapOne, 'shine');
            var myMapTwo = myEcharts.init(containerMapTwo, 'shine');
            var myMapThree = myEcharts.init(containerMapThree, 'shine');
            var myMapFour = myEcharts.init(containerMapFour, 'shine');
            var myMapFive = myEcharts.init(containerMapFive, 'shine');
            var MapNameOne=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜市场统计地区分布图(全面统计)';
            var MapNameTwo=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜企业统计地区分布图(全面统计)';
            var MapNameThree=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜农民合作社统计地区分布图(全面统计)';
            var MapNameFour=self.CurrentYear+'年(八)'+self.CurrentAreaName+'蔬菜家庭农场统计地区分布图(全面统计)';
            var MapNameFive=self.CurrentYear+'年(八)'+self.CurrentAreaName+'相关质量标准认证情况统计地区分布图(全面统计)';
            var optionMapOne = self.GetMapOption(MapNameOne,self.GeoData,self.mapType,self.echartsItem0,self.mapList0);
            var optionMapTwo = self.GetMapOption(MapNameTwo,self.GeoData,self.mapType,self.echartsItem1,self.mapList1);
            var optionMapThree = self.GetMapOption(MapNameThree,self.GeoData,self.mapType,self.echartsItem2,self.mapList2);
            var optionMapFour = self.GetMapOption(MapNameFour,self.GeoData,self.mapType,self.echartsItem3,self.mapList3);
            var optionMapFive = self.GetMapOption(MapNameFive,self.GeoData,self.mapType,self.echartsItem4,self.mapList4);
            myMapOne.setOption(optionMapOne);
            myMapTwo.setOption(optionMapTwo);
            myMapThree.setOption(optionMapThree);
            myMapFour.setOption(optionMapFour);
            myMapFive.setOption(optionMapFive);
            //用于使chart自适应高度和宽度
            window.onresize = function () {
                //重置容器高宽
                resizeContainerBar();
                resizeContainerMap();
                myMapOne.resize();
                myMapTwo.resize();
                myMapThree.resize();
                myMapFour.resize();
                myMapFive.resize();
                myBarOne.resize();
                myBarTwo.resize();
                myBarThree.resize();
                myBarFour.resize();
                myBarFive.resize();
            };
        },
        getDetail(AreaCode){//获取详情  
            var self=this;
            self.detailView=true;   
            self.searchModel.AreaCode=AreaCode;
            self.$http.post('VegProsecution/PostDetailStats', self.searchModel).then(function (res) {
                if(res.data.status===1){
                    self.CurrentAreaName=res.data.model[0].AreaName;
                    self.detailDatas= res.data.model;
                }
            });
        },
        getExcelData(){
            window.open(this.$http.defaults.baseURL + "VegProsecution/GetStatsExcelData?AreaCode="+this.searchModel.AreaCode+"&&FillInYear="+this.searchModel.FillInYear+"&&Status="+this.searchModel.Status);
        },
    },
    //创建Vue页面方法
    created: function () {
        this.changeButton("listShow");
        this.getStatsList();
           },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>
<style scoped src="../../styles/stats.css"></style>
